<?php
/**
 * Created by PhpStorm.
 * User: yandian
 * Date: 2017/4/27
 * Time: 01:11
 */

namespace app\weixin\controller;


use app\common\controller\LiteBase;
use app\common\util\LoginManager;

class Message extends LiteBase
{

    private function getData()
    {
        return \app\common\model\SysMsg::instance()
            ->gotoPage()
            ->order('id desc')->select();
    }
    private function getData2()
    {
        return \app\common\model\MemberMsg::instance()
            ->gotoPage()
            ->where(['member_id'=>LoginManager::getLoginUserId()])
            ->order('id desc')->select();
    }

    public function sys()
    {
        $this->assign('t',1);
        $this->assign('m', $this->getData());
        return $this->fetch('list');
    }

    public function jsonList()
    {
        return $this->jsonSuccess($this->getData());
    }


    public function member()
    {
        $this->assign('m', $this->getData2());
        $this->assign('t',2);
        return $this->fetch('list');
    }


    public function jsonList2()
    {
        return $this->jsonSuccess($this->getData2());
    }
}